package com.proxy.JdkProxy;

import com.proxy.service.SmsService;
import com.proxy.service.SmsServiceImpl;
import java.lang.reflect.Proxy;

public class JdkProxyFactory {
    public JdkProxyFactory() {
    }

    public static Object getInstance(Object target) {
        return Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getClass().getInterfaces(), new JdkHandler(target));
    }

    public static void main(String[] args) {
        SmsService smsService = (SmsService)getInstance(new SmsServiceImpl());
        smsService.send("短信内容！");
    }
}